package com.ywjt.platformbusiness.my.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.ywjt.platformbusiness.R;
import com.ywjt.platformbusiness.base.BaseActivity;
import com.ywjt.platformbusiness.my.adapter.WithDrawTypeAdapter;
import com.ywjt.platformbusiness.widget.PayTypeBottomDialog;
import java.util.ArrayList;
import java.util.List;

public class WithDrawTypeActivity extends BaseActivity implements View.OnClickListener {

    private RecyclerView rcCommon;
    private List<String> data;
    private WithDrawTypeAdapter balanceAdapter;
    private TextView tvSure;
    private LinearLayout llAddType;


    public static void actionStart(Context context) {
        Intent intent = new Intent(context, WithDrawTypeActivity.class);
        context.startActivity(intent);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.tvSure:
                ActivityWithdraw.actionStart(this);
                break;
            case R.id.llAddType:
                PayTypeBottomDialog dialog=new PayTypeBottomDialog();
                dialog.setClicklistener(new PayTypeBottomDialog.ClickListenerInterface() {
                    @Override
                    public void alipay() {
                        ActivityAddAliPay.actionStart(WithDrawTypeActivity.this);
                        dialog.dismiss();
                    }

                    @Override
                    public void bank() {
                        ActivityAddBankCard.actionStart(WithDrawTypeActivity.this);
                        dialog.dismiss();
                    }

                    @Override
                    public void sure() {
                        dialog.dismiss();
                    }
                });
                dialog.show(getSupportFragmentManager());
                break;
        }
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        setAndroidNativeLightStatusBar(true);
    }

    @Override
    protected int setLayoutResourceID() {
        return R.layout.activity_withdraw_type;
    }

    @Override
    protected void initView() {
        setTitleText("选择提现方式");
        rcCommon=findViewById(R.id.rcCommon);
        tvSure=findViewById(R.id.tvSure);
        llAddType=findViewById(R.id.llAddType);
        tvSure.setOnClickListener(this::onClick);
        llAddType.setOnClickListener(this::onClick);

        data=new ArrayList<>();
        data.add("");
        data.add("");
        data.add("");
        data.add("");
        balanceAdapter=new WithDrawTypeAdapter(data);
        rcCommon.setAdapter(balanceAdapter);
        rcCommon.setLayoutManager(new LinearLayoutManager(this));
    }

    @Override
    protected void initData() {

    }

    /**
     * 获取要使用的标题栏样式(此函数由子类重写)
     * @return
     */
    @Override
    protected int getTitleBarType() {
        return 0;
    }
}
